package com.heima.bank_work;

public class BankAccount {
    private String accountNumber;
    private String accountHolder;
    private double balance;
    private static int totalAccounts;

    public BankAccount() {
        totalAccounts++;
    }

    public BankAccount(String accountNumber, String accountHolder, double balance) {
        this.accountNumber = accountNumber;
        this.accountHolder = accountHolder;
        this.balance = balance;
        totalAccounts++;
    }

    public double getBalance() {
        return balance;
    }

    public void setBalance(double balance) {
        this.balance = balance;
    }

    public String getAccountNumber() {
        return accountNumber;
    }

    public void setAccountNumber(String accountNumber) {
        this.accountNumber = accountNumber;
    }

    public String getAccountHolder() {
        return accountHolder;
    }

    public void setAccountHolder(String accountHolder) {
        this.accountHolder = accountHolder;
    }

    public static int getTotalAccounts() {
        return totalAccounts;
    }

    public static void setTotalAccounts(int totalAccounts) {
        BankAccount.totalAccounts = totalAccounts;
    }
    public void deposit(double amount) {
        if(amount > 0){
            this.balance += amount;
            System.out.println("存款成功");
        }else {
            System.out.println("逼崽子,拿爷消遣呢,要不重新输,要不换银行");
        }
    }
    public void withdraw(double amount) {
        if(amount < balance){
            this.balance -= amount;
            System.out.println("取款成功");
        }else {
            System.out.println("呵呵,没钱硬取?");
        }
    }
}
